package com.findu.control;

import java.util.List;

import com.example.findu.R;
import com.findu.model.App;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Activity_selectdyNamic_gardenful_MYAdapter extends BaseAdapter{
	private Context context;
	private List<App> text;
	TextView textView_Name,textView_Jurisdiction ;
	
	public Activity_selectdyNamic_gardenful_MYAdapter(Context context,List<App> text){
		this.context = context;
		this.text = text;
	}
	@Override
	public int getCount() {
		return text.size();
	}

	@Override
	public Object getItem(int position) {
		return text.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final int index = position;	//�õ���ѡ��
		View view = convertView;	//�õ���ͼ
		//防止重复加载view
		if(view == null){
			LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
			//引入布局文件
			view = inflater.inflate(R.layout.activity_view_selectnamic_gradenful_list_item, null);
		}
		//初始化项控件
		textView_Name =  (TextView) view.findViewById(R.id.activity_view_selectnamic_gardenful_item_textview_Name);
		textView_Jurisdiction = (TextView) view.findViewById(R.id.activity_view_selectnamic_gardenful_item_textview_Jurisdiction);
		
		textView_Name.setText(text.get(position).getName());
		textView_Jurisdiction.setText(text.get(position).getJurisdiction());
		return view;
	}

}
